package com.cd.music.controller;

import com.cd.music.annotation.Parameter;
import com.cd.music.annotation.RequestLimit;
import com.cd.music.dto.UserDto;
import com.cd.music.service.AuthCodeService;
import com.cd.music.utils.ResultUtil;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author yxl 余秀良
 * @version 1.0
 * @description: 用途
 * @date 2018年02月07日  下午2:30
 * @address: 四川成都
 */
@RestController
@CrossOrigin
@RequestMapping("snd/sms")
public class SmsController {

    @Resource(name = "authCodeService")
    private AuthCodeService authCodeService;

    @RequestLimit(count = 1)
    @PostMapping("opt=query&fid=login")
    public String login(@Parameter UserDto dto) {
        return ResultUtil.result(authCodeService.senLoginAuthCode(dto));
    }

    @RequestLimit(count = 1)
    @PostMapping("opt=update&fid=reg")
    public String reg(@Parameter UserDto dto) {
        return ResultUtil.result(authCodeService.senRegisterAuthCode(dto));
    }

    @RequestLimit(count = 1)
    @PostMapping("opt=update&fid=updatePwd")
    public String updatePwd(@Parameter UserDto dto) {
        return ResultUtil.result(authCodeService.senUpdatePwdAuthCode(dto));
    }

}
